import java.util.Scanner;

public class exercise2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入还款方式:");
        String return_method = sc.next();
        System.out.println("还款方式:" + return_method);
        System.out.print("贷款总额（万元）:");
        int total_memory = sc.nextInt();
        System.out.print("贷款时间（月数）:");
        int months = sc.nextInt();
        System.out.print("年利率:");
        String string_year_percent = sc.next(".+%");
        string_year_percent = string_year_percent.substring(0,string_year_percent.length() - 1);
        double year_percent = Double.parseDouble(string_year_percent) / 100;
        double month_percent = year_percent / 12.0;
        if (return_method.equals("等额本金")){
            System.out.println("总利息(万元):" + ((months + 1) * total_memory * month_percent )/ 2);
        }
        else{
            System.out.println("总利息(万元):" + (((months * total_memory * month_percent * Math.pow((1+month_percent),months)) / (Math.pow((1+month_percent),months) - 1)) - total_memory));
        }
    }
}
